<html>
<head>
	<meta charset="utf-8">	
	<title>喵~~</title>
	<link rel="stylesheet" type="text/css" href="../../style.css">
</head>
<body>
	<h1>喵星聊天室</h1>
	<script src="../../../thirdparty/av-min.js"></script>
	<script src="../init.js"></script>
	<script src="data.js"></script>
	<script src="https://pv.sohu.com/cityjson"></script>
	<script>
		function ipaddr() {
			ip = returnCitySN["cip"];
			return ip.slice(0, ip.lastIndexOf('.')) + ".*";
		}
		function convdata(str) {
			return str.replace(/</g, "&lt;").replace(/>/g, "&gt;");
		}
		function setcookie(cname,cvalue,exdays){
			var d = new Date();
			d.setTime(d.getTime()+(exdays*24*60*60*1000));
			var expires = "expires="+d.toGMTString();
			document.cookie = cname+"="+cvalue+"; "+expires;
		}
		function getcookie(cname){
			var name = cname + "=";
			var ca = document.cookie.split(';');
			for(var i=0; i<ca.length; i++) {
				var c = ca[i].trim();
				if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
			}
			return "";
		}
		// console.log(ipaddr());
	</script>
	<iframe height="80%" width="40%" frameborder="0" src="message.html?msg=10" id="display"></iframe>
	<br />
	<input type="text" id="user" placeholder="用户名">
	<input type="text" id="message" placeholder="信息">
	<input type="button" value="发送" onclick="setcookie('_u_n_', document.getElementById('user').value, 365); sendmsg(convdata(document.getElementById('user').value), convdata(document.getElementById('message').value), ipaddr()); document.getElementById('display').contentWindow.location.reload();">
	<input type="button" value="刷新" onclick="document.getElementById('display').contentWindow.location.reload();">
	<script> document.getElementById('user').value=getcookie('_u_n_'); </script>
	<!-- 这段稍微有点乱，我之后再改 -->
	<br />
	<small><a href="../../blog/content/notice_board.html">关于为什么要手动输入用户名，请看这里</a><small>
</body>
</html>
